UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7gRgdaMiSHnbTeQjsItM9c8DewgcCxKn6FLeCeu4Qtw=' 
WHERE 
  key_id = '114a011839139065bc36585adc24791b64c399ca7ec4b5a7682989d469288968' 
  AND (
    token = '7gRgdaMiSHnbTeQjsItM9c8DewgcCxKn6FLeCeu4Qtw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00221