UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b27Zn1RQn+8q43GwKvm1O1yt+OuOWpN23Xo/5Rudou4='
WHERE
key_id = 'bd509acbf4b7ab8b8ead38415ffb6bd8033bf895e9a33c11cfc0fd75c0eb1cb7'
AND (
token = 'b27Zn1RQn+8q43GwKvm1O1yt+OuOWpN23Xo/5Rudou4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)