UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BLpvL8+gsQl0K8JS1LNnTHgtdeT9ENaNv7XgfyqQOoM='
WHERE
key_id = '6c20d4e859048567518a78c1ed9623c6f13c07c14621a7ecc65bb15148e8014a'
AND (
token = 'BLpvL8+gsQl0K8JS1LNnTHgtdeT9ENaNv7XgfyqQOoM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)