UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W/6DmrBtBDD/1LpCg+G5ib30KzpOi47SFHEbC6eTlFU='
WHERE
key_id = 'd78f2fddb6752cdce35a22b255416d99795bb70285eb092ea02ce2459c517ccc'
AND (
token = 'W/6DmrBtBDD/1LpCg+G5ib30KzpOi47SFHEbC6eTlFU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)