UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jW24MYfGT1TxMwE/oGptNgM8CDamfKtTEbxJgDAMhTY='
WHERE
key_id = 'dc70a6cbba508a36fd4a42e04f9f83205d9817caefdf23e9f97ed8d8b9d007ce'
AND (
token = 'jW24MYfGT1TxMwE/oGptNgM8CDamfKtTEbxJgDAMhTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)