UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pNDKn1nySW63VinCz2JZB1CL8tcUQoDl1x81x59CUAQ='
WHERE
key_id = '2617948f9a467a5c7ac47911070a3f6dba31a43f5376e0f8d71284d633b6c9c1'
AND (
token = 'pNDKn1nySW63VinCz2JZB1CL8tcUQoDl1x81x59CUAQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)