UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lfK6nybuJLXxkkGiWl0ILoW1E8U8minKi0+dbS4sTjE='
WHERE
key_id = 'e80812a259f110f0dae0281250c57b3da2381929f5824998090b3c87704ab25a'
AND (
token = 'lfK6nybuJLXxkkGiWl0ILoW1E8U8minKi0+dbS4sTjE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)