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

Query time 0.00040