UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IxFx2lbpxCn3KMHG/3TVScSc9mb2/i2hWiGBJbKgjY0='
WHERE
key_id = 'd171335ba1d7d21984f981776a7821043a4dcd38c6fb3090234bdf4516e19978'
AND (
token = 'IxFx2lbpxCn3KMHG/3TVScSc9mb2/i2hWiGBJbKgjY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)