UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iwzCWKw+6TzXpFVeC9cDQkPZGpteUlcEdCVEK99W3/s='
WHERE
key_id = '9e31354d7f2e108ba8b657d5db72a6227fc08a48ffa05f43dceee6dbdbf6a5dd'
AND (
token = 'iwzCWKw+6TzXpFVeC9cDQkPZGpteUlcEdCVEK99W3/s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)