UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IUVrxgyUs87hEbenkOZfYHfuHWZd8tsDugUAhfmPRns=' 
WHERE 
  key_id = '2456701edb495575bd75385b77250d5836d0de07689a3b86bd165c07e6ff3b10' 
  AND (
    token = 'IUVrxgyUs87hEbenkOZfYHfuHWZd8tsDugUAhfmPRns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039