UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MVdlHXFlljZL8tPHyyFwmwcKdU+H+5fdx7BdqtoaaVg='
WHERE
key_id = 'd30622c0b48c6316b942917e30cb53ec63eebedd0a8de66cc4572213516582de'
AND (
token = 'MVdlHXFlljZL8tPHyyFwmwcKdU+H+5fdx7BdqtoaaVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)