UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wh0i2y2aNNIBwa60GfGYH2r1AnvAMFmrC9NNiHQS+Qs=' 
WHERE 
  key_id = '8a0352600c8a325dafd6fc1cf25fb6508fe31b21e109326d1690922ff6de7e1d' 
  AND (
    token = 'wh0i2y2aNNIBwa60GfGYH2r1AnvAMFmrC9NNiHQS+Qs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019