UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tDid6BbKGm7pSC1rDspVIW1cg+3W/vFJ46W3jmOazzE='
WHERE
key_id = 'f0e8e1a52d0ee232096acf085165f2346367c63e44fdc4835b3349c29b91bbc4'
AND (
token = 'tDid6BbKGm7pSC1rDspVIW1cg+3W/vFJ46W3jmOazzE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)