UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YDCaKNlh1oETpP2z/QhAnKe0UL/mLHIVfTWi/wR4ly0='
WHERE
key_id = '51c2cb2e404d80695cd804916e3a8a00d14d7233fae6f5c009477615e03452c6'
AND (
token = 'YDCaKNlh1oETpP2z/QhAnKe0UL/mLHIVfTWi/wR4ly0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)