UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wXrx6PDgnU66G+3j6FN3D9enEvFwTZEJ0UkEnemXx9A='
WHERE
key_id = 'b2a3a47d307035667330f9bb09150d153bfb05efc5f6cb5a2249d1ec09092393'
AND (
token = 'wXrx6PDgnU66G+3j6FN3D9enEvFwTZEJ0UkEnemXx9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)