UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Le3xww5I7Ii9ZhsBBC8qnx/PE3d5i8wBuQfoKpedv+0=' 
WHERE 
  key_id = 'cb92d1777f52f9d988dd4264abb74a7b67b1e5de9d4df95e86082092991ac4ee' 
  AND (
    token = 'Le3xww5I7Ii9ZhsBBC8qnx/PE3d5i8wBuQfoKpedv+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022