UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XWPM8zoJIPazzkHWOGa1PovaQ11R1ENy8XcC/mOT3Bs='
WHERE
key_id = '33f5891e29d98621f0db4b377522c28354cece704ad45643468ad6cc8448a10a'
AND (
token = 'XWPM8zoJIPazzkHWOGa1PovaQ11R1ENy8XcC/mOT3Bs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)