UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KmrRCv09poxtwNd1hrO4x0qCjIvo/GoFJqv/Pf+zreg='
WHERE
key_id = 'db81f3002055c24f008fcff8fed1113503f2afb67a2b4d78954303c6871f2d47'
AND (
token = 'KmrRCv09poxtwNd1hrO4x0qCjIvo/GoFJqv/Pf+zreg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)