UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kvGvgsSxE9WUsBoqbxUDFRWrl7LMY2BkDMKN5wmQwVY=' 
WHERE 
  key_id = '51f7fe36bf1528f2d98b832c0b95143406355c27a8206ddd9d4bcd9946263845' 
  AND (
    token = 'kvGvgsSxE9WUsBoqbxUDFRWrl7LMY2BkDMKN5wmQwVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021