UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8CnHEjNJBAQ2p2myt0v5sSnYMpwZr6+XCVtogVrXAGg='
WHERE
key_id = 'f3af2b1e917db10f5cec47a94ee180dd85bf4718454665c2983d9137c027a279'
AND (
token = '8CnHEjNJBAQ2p2myt0v5sSnYMpwZr6+XCVtogVrXAGg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)