UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wBNKSeOvnhVTPRZ+Noa5pCLSLTbL052e0CGKmY9IMrQ='
WHERE
key_id = 'cac21b14fccfea59bad2a5eb83864da85c876dfa42dd325b60f30c1db50b4ca7'
AND (
token = 'wBNKSeOvnhVTPRZ+Noa5pCLSLTbL052e0CGKmY9IMrQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)