UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NAZt2DLJEmB5ci/boHE1RWCoqr8+KThfrtgcw4gvF6I='
WHERE
key_id = 'bab322f6f5dd72e37ba2c1f074ec1d0edbcb409dfed3ef28111b7b8c4155f7af'
AND (
token = 'NAZt2DLJEmB5ci/boHE1RWCoqr8+KThfrtgcw4gvF6I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)