UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KSon7jSrvh7KDbzjztGPzirOTZ9Gw9O4G5J4CNhovrk=' 
WHERE 
  key_id = '62caaaa10532b13ebde6fbc16e947c583ed2c20836ee029664eb11d2b589a328' 
  AND (
    token = 'KSon7jSrvh7KDbzjztGPzirOTZ9Gw9O4G5J4CNhovrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034