UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xBqwH5ZXkXtM06CXP17PQzoHMD8qkFtBOr4npINNPgM='
WHERE
key_id = '1a133ea83ee2f41ded6202a98a490d5e394ec3349d0713ebf8b2196e220560fc'
AND (
token = 'xBqwH5ZXkXtM06CXP17PQzoHMD8qkFtBOr4npINNPgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)