UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lokUk0VXqcvSX1rA1yAfUNXGzl0js7DEFEgzZWTjZgo='
WHERE
key_id = '64df48631a0b83ce4cc62fc91e3d530a619695a78f762b51fb07afd50ec29612'
AND (
token = 'lokUk0VXqcvSX1rA1yAfUNXGzl0js7DEFEgzZWTjZgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)