UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kI3SLXaePlOCJtoo54Atw9TnY5gTN3vMRzQiP0Q62Yk='
WHERE
key_id = 'ef9397f1021d176da7269019df7b847d8686fcab4bc1d95c985c662b6928da30'
AND (
token = 'kI3SLXaePlOCJtoo54Atw9TnY5gTN3vMRzQiP0Q62Yk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)