UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'faDSQKRbgLxZBH9mkD++b2reHL8pxBCB05gNC977jfs=' 
WHERE 
  key_id = 'd01df226805db59777655965087023e84c9b8dd35c5315747bed3a179421d00b' 
  AND (
    token = 'faDSQKRbgLxZBH9mkD++b2reHL8pxBCB05gNC977jfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032