UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+b1NuaSFomGc9/KpIStF+3BLj4g/VBRbbVjvfg4mh04=' 
WHERE 
  key_id = '9723dd7b3d972a74f2a963223e336974778c7dd46a52b0cbf41910f2aeda7045' 
  AND (
    token = '+b1NuaSFomGc9/KpIStF+3BLj4g/VBRbbVjvfg4mh04=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033