UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '64mFsRHFTz1NtbZk4Nn2tXAgtZuU+cysC0NQ1ZL1NuE=' 
WHERE 
  key_id = 'c4c742b3b49dbf39a411fff30e55563668258b1317d0b8fb072587fa0da1b5ca' 
  AND (
    token = '64mFsRHFTz1NtbZk4Nn2tXAgtZuU+cysC0NQ1ZL1NuE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041