UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BqNQVoeUiSGbDHSWscR+zRJ8jrWHK72tEtZjXZWH5ck='
WHERE
key_id = 'a916fa291a388d403331874d3141bf0bbc4948d2ebe7ac16a8394f0bdf44f9c1'
AND (
token = 'BqNQVoeUiSGbDHSWscR+zRJ8jrWHK72tEtZjXZWH5ck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)