UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FpS/vjviLHjo6l+D9b6jvD8W+1Z5ck15Vq7XsmJfNFE=' 
WHERE 
  key_id = 'beff262eb32d95aeee8ef19bf5d50e2f9d35de804794b518b091d493f24fd867' 
  AND (
    token = 'FpS/vjviLHjo6l+D9b6jvD8W+1Z5ck15Vq7XsmJfNFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026