UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bE5hy44W5Ci7t//5/xu8QPCGZQcSveREOkZ5rlyOouo='
WHERE
key_id = 'd831df8df4d643c1fa3926a9372b71a2ae749c7ba47982e4cbc5446d4d4c3465'
AND (
token = 'bE5hy44W5Ci7t//5/xu8QPCGZQcSveREOkZ5rlyOouo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)