UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kkeXvq+u+6tbv4QNwRHw7HnIaMeqva0tIzf8wX270lo=' 
WHERE 
  key_id = '31ab3ece5bd9a6adc1f24e21e9f7dfb58161c86586e197c8a2d1fd57aad03ab7' 
  AND (
    token = 'kkeXvq+u+6tbv4QNwRHw7HnIaMeqva0tIzf8wX270lo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028