UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'clk801r1bRhHNrcWvf4V95OzU6jdFs0dyF9telV5GVE='
WHERE
key_id = '3ffa82b66597bd53de017e86c0244d267e9cdee076bab90cfe4881d0c2f17ed0'
AND (
token = 'clk801r1bRhHNrcWvf4V95OzU6jdFs0dyF9telV5GVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)