UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2Gt7DE59z344lBXYMDFoLYI4K0edvt8T+tsf0yBl5JY='
WHERE
key_id = '066e98746541ec3df42d3abebb30f69b912130fcfd6840e21a6db3d7d1d251af'
AND (
token = '2Gt7DE59z344lBXYMDFoLYI4K0edvt8T+tsf0yBl5JY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)