UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6FcGDZbcxfJKrptzYCAIc8IrZVtuteYQmPAjFoQ5fvA='
WHERE
key_id = 'fd1f8a072ac19de84884b8a95d1d48f807191f9b410d07158180d049aeb336c2'
AND (
token = '6FcGDZbcxfJKrptzYCAIc8IrZVtuteYQmPAjFoQ5fvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)