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

Query time 0.00052