UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'onW5jkAAjIzJ7vuqVYRq10pMP8cXR1SVQ+qH6fwHZII=' 
WHERE 
  key_id = 'f378cc4fff5260e10d967de85209e0475ffa7618e69fc4fb3e063d733d0be6d1' 
  AND (
    token = 'onW5jkAAjIzJ7vuqVYRq10pMP8cXR1SVQ+qH6fwHZII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047