UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0HJWzy4tQAMWDHz5YzgWLhW0Nqj4NpR6zDnN6VfyXIc='
WHERE
key_id = '49ee18e0cac18334a4f9b3b45fb6b67ada716358948151c94697e06b5d80c0c0'
AND (
token = '0HJWzy4tQAMWDHz5YzgWLhW0Nqj4NpR6zDnN6VfyXIc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)