UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xxY9iqRicofSpL/ps/ruuu07VjSqfobE8Ig4pNjXMBs=' 
WHERE 
  key_id = '6d5dd997d5e884fcbf1533e581b7aeb74571adb4de8f5b3d7c2a096daa834371' 
  AND (
    token = 'xxY9iqRicofSpL/ps/ruuu07VjSqfobE8Ig4pNjXMBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018