UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aHY8AzFzk69D9YGqbcl5r05Ly4ZXHly99qQZVEQz1bo='
WHERE
key_id = '59a747b5eb93bb817b0cd3a00b2658a13fb86011da9420cb7670f9039f09a166'
AND (
token = 'aHY8AzFzk69D9YGqbcl5r05Ly4ZXHly99qQZVEQz1bo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)