UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pbBdSN3wgBCvMDbEaf4D/7d0B9Nk0flRKjdArC6TVIU='
WHERE
key_id = 'd2462ce6cfffed0c75d2e4139db2df58572260c479f83eb7b9f0975973126de3'
AND (
token = 'pbBdSN3wgBCvMDbEaf4D/7d0B9Nk0flRKjdArC6TVIU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)