UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fZyQ6Jih67/s7ICvX7uUQnDTlkaVWG2v/YBGFwYK+YU=' 
WHERE 
  key_id = '3875b5c252745ecd67f5f0e408a0bb707e411a6b8031f95965e223259bba5d3a' 
  AND (
    token = 'fZyQ6Jih67/s7ICvX7uUQnDTlkaVWG2v/YBGFwYK+YU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027