UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vJJ/SF9Ee8NoMPREPmd0ZeeMY7NNsc1GxvxVMBtpOU0=' 
WHERE 
  key_id = 'd18780e4b71f20576f6d7256c7fe4209c4392c91e8494aaa8b27c9206d60e216' 
  AND (
    token = 'vJJ/SF9Ee8NoMPREPmd0ZeeMY7NNsc1GxvxVMBtpOU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029