UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rEyUAYHyR6B+r+dyxtfg+3m799yk/ewVx/r7PWqxtg8=' 
WHERE 
  key_id = 'd22ae2cd4fc6f1ff995e801e41784ce3822dd12aaea506c33b9eda3405ef77e6' 
  AND (
    token = 'rEyUAYHyR6B+r+dyxtfg+3m799yk/ewVx/r7PWqxtg8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029