UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xNJyUIU8ocUP9Sx5Jv1e3QX/002/W+wM45106oXxi+o='
WHERE
key_id = '5d96c31ff4327babb4c44014615fb36ddef79dab48c07ab8932d378dcc5c3dad'
AND (
token = 'xNJyUIU8ocUP9Sx5Jv1e3QX/002/W+wM45106oXxi+o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)