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