UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iw5KaYuy8XF6ErQBXzGepdgqgNWp0kyPWZYSTvVkITc=' 
WHERE 
  key_id = 'f416bc13358559728c2314879f1a123cde7f9d92bbe3f0c5b124dbfa311a8186' 
  AND (
    token = 'Iw5KaYuy8XF6ErQBXzGepdgqgNWp0kyPWZYSTvVkITc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040