UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JafKPes8Hn0XYNjUr3CwFMse2IwxFfsYuIb+bzOuew0=' 
WHERE 
  key_id = '9a09f427ed2484ec85c21efca623d3d1ebba4dbaf5a72257f091641126ea8a58' 
  AND (
    token = 'JafKPes8Hn0XYNjUr3CwFMse2IwxFfsYuIb+bzOuew0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036