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