UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ealwhiHey2xQfbPGUqhfn9eRlMUKGFIpyYoppKxfs9A='
WHERE
key_id = '4be5dc08c0c525332c78de6f81810c41dfd5f3949e32b14a04e6cf893796b585'
AND (
token = 'ealwhiHey2xQfbPGUqhfn9eRlMUKGFIpyYoppKxfs9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)